import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../components/login.vue'
import Member from '../components/members.vue'
import Shopcar from '../components/shopcar.vue'
import Serach from '../components/serach.vue'
import Newlist from '../components/new/newlist.vue'
import Images from '../components/images/images.vue'
import Goods from '../components/goods/goods.vue'
import Loginone from '../components/loginone.vue'
import Home from '../components/home.vue'
import Comment from '../components/commomt.vue'
import First from '../components/images/first.vue'
import Two from '../components/images/two.vue'
import firstInfo from '../components/images/first_infio.vue'
import GoodsInfo from '../components/goods/goodsinfo.vue'
Vue.use(VueRouter)

const routes = [
    { path: '/loginone', component: Loginone },
    { path: '/', redirect: '/loginone' },
    {
        path: '/home',
        component: Home,
        children: [
            { path: '/', redirect: '/login' },
            { path: '/login', component: Login },
            { path: '/member', component: Member },
            { path: '/shopcar', component: Shopcar },
            { path: '/serach', component: Serach },
            { path: '/login/newlist', component: Newlist },
            {
                path: '/login/images',
                component: Images,
                children: [
                    { path: '/', redirect: '1' },
                    { path: '1', component: First },
                    { path: '2', component: Two },
                    { path: '1/:id', component: firstInfo }
                ]
            },
            { path: '/login/goods', component: Goods },
            { path: '/login/goods/:id', component: GoodsInfo },
            { path: '/login/:id', component: Comment }
        ]
    }
]

const router = new VueRouter({
    routes,
    linkActiveClass: 'mui-active' // 给每个路由设置默认高亮，当点击到的时候变成高亮
})

export default router